import subprocess
import os.path
import os,sys,shutil

#需要遍历使用cleanup的目录
respath = [""]
#直接cleanup的目录
resPath2 = []

def cleanUp(res):
	print("clean up "+res)
	p = subprocess.Popen([r"powersheel","svn cleanup "+res],shell=True,stdout=subprocess.PIPE,stderr=subprocess.STDOUT)
	output,stderr = p.communicate()
	status = p.returncode
	#status==0 表示执行正常
	print(status)


def checkFile(path,file):
	url = path + "\\" +file
	if os.path.isdir(url) and file.find(".svn")<=-1:
		cleanUp(url)


for path2 in resPath2:
	cleanUp(url)

for path1 in resPath:
	files = os.listdir(path1)
	for file2 in files:
		checkFile(path1,file2)

print("prefect!!!")
os.system("pause")